<template>
    <section>
        <!--工具条-->
        <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
            <el-form :inline="true" :model="filters">
                <el-form-item>
                    <el-input v-model="query.keyword" placeholder="关键字"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="search">查询</el-button>
                </el-form-item>

            </el-form>
        </el-col>

        <!--列表-->
        <el-table :data="pageInfo.rows"
                  style="width: 100%;">

            <el-table-column type="index" width="60">
            </el-table-column>
            <el-table-column prop="name" label="名字" width="120">
            </el-table-column>
            <el-table-column prop="url" label="url" width="180">
            </el-table-column>
            <el-table-column prop="sn" label="sn" width="220">
            </el-table-column>
            <el-table-column prop="parent.name" label="父权限" width="120">
            </el-table-column>
            <el-table-column prop="descs" label="描述" min-width="120">
            </el-table-column>



        </el-table>
        <el-pagination layout="prev, pager, next" @current-change="handleCurrentChange" :page-size="query.PageSize"
                       :current-page="query.currentPage"
                       :total="pageInfo.total" style="float:right;">
        </el-pagination>
    </section>
</template>

<script>

export default {
    data() {
        return {
            
            
            filters: {
                name: ''
            },

            pageInfo: {
                rows: [],
                total: 0
            },

            page: 1,

           

            saveLoading: false,
            saveFormVisible: false,//界面是否显示
            

            addLoading: false,

            query: {
                currentPage: 1,
                PageSize: 10,
                keyword: ""
            }
        }
    },
    methods: {
        
        search() {
            this.query.currentPage = 1;
            this.getPermission()
        },
        //点击页码的方法
        handleCurrentChange(val) {
            this.query.currentPage = val;
            this.getPermission()
        },

        getPermission() {

            this.$http.post("/permission", this.query)
                .then(result => {
                    result = result.data;
                    this.pageInfo = result.data
                })
        },

    },
    mounted() {
        this.getPermission();
    }
}

</script>

<style scoped>

</style>